package net.crowdloud.server.DatabaseAccess.user;

import net.crowdloud.server.DatabaseAccess.problem.ConvertProblemToDatabase;
import net.crowdloud.server.DatabaseAccess.solution.ConvertSolutionToDatabase;

import com.google.appengine.api.datastore.Text;

public class ConvertUserToDatabase {

	public static User getDatabaseUser(User userDatabase,
			net.crowdloud.shared.entities.User user, String tags) {

		userDatabase.setName(user.getName());

		userDatabase.setContact(user.getContact());

		userDatabase.setGroups(new Text(user.getGroups()));

		userDatabase.setUserProblems(ConvertProblemToDatabase
				.getDatabaseProblems(user.getUserProblems(), tags));

		userDatabase.setUserSolutions(ConvertSolutionToDatabase
				.getDatabaseSolutions(user.getUserSolutions(), tags));

		return userDatabase;
	}
}
